using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using JGSY.CMS.LowCode.Platform.Domain.Interfaces;

namespace JGSY.CMS.LowCode.Platform.Domain.Entities
{
    /// <summary>
    /// 语言配置实体
    /// 用于管理系统支持的多语言配置
    /// </summary>
    [Table("languages")]
    public class Language : ITenantEntity
    {
        /// <summary>
        /// 主键ID
        /// </summary>
        [Key]
        public long Id { get; set; }

        /// <summary>
        /// 语言代码
        /// 如：zh-CN, en-US, ja-JP
        /// </summary>
        [Required]
        [StringLength(10)]
        public string Code { get; set; } = string.Empty;

        /// <summary>
        /// 语言名称
        /// 如：简体中文, English, 日本語
        /// </summary>
        [Required]
        [StringLength(100)]
        public string Name { get; set; } = string.Empty;

        /// <summary>
        /// 英文名称
        /// </summary>
        [Required]
        [StringLength(100)]
        public string EnglishName { get; set; } = string.Empty;

        /// <summary>
        /// 语言图标
        /// 国旗或语言标识图片URL
        /// </summary>
        [StringLength(255)]
        public string? Icon { get; set; }

        /// <summary>
        /// 状态（启用/禁用）
        /// 0=禁用, 1=启用
        /// </summary>
        public byte Status { get; set; } = 1;

        /// <summary>
        /// 是否为默认语言
        /// </summary>
        public bool IsDefault { get; set; } = false;

        /// <summary>
        /// 排序权重
        /// </summary>
        public int SortOrder { get; set; } = 0;

        /// <summary>
        /// 创建时间
        /// </summary>
        public DateTime CreatedAt { get; set; } = DateTime.UtcNow;

        /// <summary>
        /// 修改时间
        /// </summary>
        public DateTime UpdatedAt { get; set; } = DateTime.UtcNow;

        /// <summary>
        /// 该语言的翻译文本集合
        /// </summary>
        [InverseProperty(nameof(Translation.Language))]
        public ICollection<Translation> Translations { get; set; } = new List<Translation>();

        /// <summary>
        /// 租户标识符
        /// </summary>
        public string TenantId { get; set; } = string.Empty;
    }
}
